package com.fengfeng.utils;

import android.app.Activity;
import android.widget.Toast;

/**
 * @author xiaoguokeng
 * @Date 2024/8/7
 */
public class FFToastUtils {
    private Activity mActivity;
    private static FFToastUtils mInstance;
    private FFToastUtils(){}
    public static FFToastUtils getInstance(){
        if(mInstance == null){
            mInstance = new FFToastUtils();
        }
        return mInstance;
    }
    public void setActivity(Activity activity){
        mActivity = activity;
    }

    public void showToast(Object object){
        if(mActivity!=null){
            mActivity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(mActivity,object.toString(),Toast.LENGTH_SHORT).show();
                }
            });
        }
    }
}
